package com.ming.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

@RestController
public class SendMessageController {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 发送消息
     * @param message
     * @return
     */
    @GetMapping("/sendDirectMessage/{message}")
    public String sendDirectMessage(@PathVariable String message) {
        String queueName = "simple.queue";
        rabbitTemplate.convertAndSend(queueName, message);
        return "ok";
    }
}
